Use Tag Member

 

Tag members allow you to change the properties of each tag.

 

Let's take an example of using a tag member of an analog input tag.

 

Example 1) Change the values of HiHi, High, Low, LoLo of the analog input tag on the localmain.

 

First of all, create four analog memory tags (HIHISET, HIGHHSET, LOWSET, LOLOSET) that can input the values of HiHi, High, Low, and LoLo.

Organize the screen as shown in the following figure.

 

<Organize the screen to change analog alarm settings>

 

You can organize the screen as above and write it on the 'Apply' button as follows.

(If the analog tag name you want to change is ANALOG)

 

ANALOG.hihi = $HIHISET;

ANALOG.high = $HIGHSET;

ANALOG.low = $LOWSET;

ANALOG.lolo = $LOLOSET;

 

If you write it as above, it's done.

$AI Current value
$AI.value Current value
$AI.des Description
$AI.hihi Current value
$AI.high High
$AI.low Low
$AI.lolo LoLo
$AI.full Full
$AI.base Base
$AI.viewfull ViewFull
$AI.viewbase ViewBase
$AI.unit Unit of tag
$AI.assign When using a tag as an indirect tag, copy a regular tag here and then the copied tag will be assigned.
$AI.ProtectScan Scan prohibited or not
$AI.ProtectControl Control prohibited or not
$AI.ProtectAlarmEvent Alarm Event prohibited or not
$AI.ProtectAlarmData Alarm data storage prohibited or not
$AI.NeedAlarmConfirm If the alarm is in progress, turn it on, and turn it off if the user check or alarm is turned off
$AI.SumTotal Total accumulated value
$AI.SumPart Partial accumulated value

Reference : More Information about Tag Member

 

Example 2) Change the properties of analog output tags

 

For example, if an analog input value is entered and its digit is hundreds digit, the output is given to 1 decimal point (extra2's value is 3), if thousands digit is entered, there is no decimal point (extra2's value is 4), if tens digit is entered, 2 decimal places (extra2's value is 2), and if one digit is entered, 3 decimal places (extra2's value is 1).

 

Then you will be able to write the script as follows.

(The input tag is INPUTAI, the output tag is OUTPUTAO, and the attribute of OUTPUTAO is given except for Extra2.)

 

if ( $INPUTAI < 10 ){

$OUTPUTAO.extra2 = 1;

$OUTPUTAO.value = $INPUTAI;

return;

}

if ( $INPUTAI >= 10 && $INPUTAI < 100){

$OUTPUTAO.extra2 = 2;

$OUTPUTAO.value = $INPUTAI;

return;

}

if ( $INPUTAI >= 100 && $INPUTAI <1000 ){

$OUTPUTAO.extra2 = 3;

$OUTPUTAO.value = $INPUTAI;

return;

}

if ( $INPUTAI >= 1000 ){

$OUTPUTAO.extra2 = 4;

$OUTPUTAO.value = $INPUTAI;

return;

}

 

If written as above, when exporting the output to the outside according to the input value of INPUTAI, the output can be exported by changing the decimal place according to Extra2. (However, this will require the protocol format to be configured in this way.)

 

$AO                              current value                                                                                                                   Float

$AO.value                     current value                                                                                                                   Float

$AO.des                       description                                                                                                                       String

$AO.port                       port                                                                                                                   int

$AO.station                   station                                                                                                               int

$AO.address                address                                                                                                           int

$AO.extra1                   extra1                                                                                                                String

$AO.extra2                   extra2                                                                                                               int

$AO.assign                  When using a tag as an indirect tag, copy a regular tag here and then the copied tag will be assigned.        int

 

Note that the Float or int values above may use the $AO.member = numerical value (or $analog tag), but if the value is in the form of a string, it is as follows.

 

@srprintf($AO.des,"This is description");

@srprintf($AO.extra1, "MW");

 

 

Properties for a digital input/output tag may be changed in the above manner.

Reference : Tag Member